

<div class="content">
    <div style="padding: 0 10px;font-size: 14px;height: 40px;line-height: 40px;">
            <a href="/admin/product/index">产品列表</a>
    </div>
<div class="panel panel-default panel-intro">

    <div class="panel-body">
        <div id="" class="tab-content">
            <div class="tab-pane fade active in" id="one">
                <div class="widget-body no-padding">
                    <div class="bootstrap-table">
                        <div class="fixed-table-toolbar">
                            <div class="bs-bars pull-left">
                                <div id="toolbar" class="toolbar" style="position: relative;">
                                    <a href="/admin/product/index_add_img?pid={$pid}" class="btn btn-success btn-add " title="添加"><i class="fa fa-plus"></i> 添加</a>
                                </div>
                            </div>
                            <form action="" method="post">
                                <table  class="table table-striped table-bordered table-hover table-nowrap" data-operate-edit="1" data-operate-del="1" width="100%">
                                    <thead>

                                    <tr>
                                        <th style="text-align: center; vertical-align: middle;width:12%;" data-field="info_order">
                                            <div class="th-inner ">排序</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle;width:4.5%;" data-field="id">
                                            <div class="th-inner ">ID</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle;width:4.5%;" data-field="info_type">
                                            <div class="th-inner ">标题</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle;width:15%;" data-field="title">
                                            <div class="th-inner ">副标题</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle;width:6%;" data-field="status">
                                            <div class="th-inner ">是否主图</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle;width:6%;" data-field="status">
                                            <div class="th-inner ">媒体类型</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle;width:6%;" data-field="status">
                                            <div class="th-inner ">外链地址</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle;width:6%;" data-field="status">
                                            <div class="th-inner ">图片</div>
                                            <div class="fht-cell"></div>
                                        </th>

                                        <th style="text-align: center; vertical-align: middle;width: 20%;" data-field="operate">
                                            <div class="th-inner ">操作</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                    </tr>
                                    </thead>
                                    <tbody data-listidx="0">
                                    {volist name="list" id="vo"}
                                    <tr data-index="0">
                                        <td style="text-align: center; vertical-align: middle; ">
                                          <input type="number" min="0" name="{$vo.id}" value="{$vo.i_order}" style="width:40px;"/>
                                        </td>
                                        <td style="text-align: center; vertical-align: middle; ">
                                            {$vo.id}
                                        </td>
                                        <td style="text-align: center; vertical-align: middle; "><!--info_type-->
                                             {$vo.title}
                                        </td>
                                        <td style="text-align: center; vertical-align: middle; ">
                                            {$vo.title2}
                                        </td>
                                        <td style="text-align: center; vertical-align: middle; ">
<!--
                                            <span  d_id="{$vo.id}" d_pid="{$pid}" d_main="{$vo.ismain}" onclick="changeStatus(this);"{if condition="$vo.ismain eq 1"} class="btn btn-success"{else/} class="btn btn-danger" {/if}>{if condition="$vo.ismain eq 1"}主图{else/}设为主图{/if}</span>
-->
                                            {if condition="$vo.ismain eq 1"}
                                            <span>主图</span>
                                            {else/}
                                            <span class="btn btn-danger" d_id="{$vo.id}" d_pid="{$pid}"  onclick="changeStatus(this);">设为主图</span>
                                            {/if}
                                        </td>
                                        <td style="text-align: center; vertical-align: middle; ">
                                            {if condition="$vo.m_type eq 1"}视频{else/}图片{/if}
                                        </td>
                                        <td style="text-align: center; vertical-align: middle; "><!--info_type-->
                                            {$vo.linkto}
                                        </td>
                                        {if condition="$vo.m_type eq 0 "}
                                        <td style="text-align: center; vertical-align: middle; "><!--info_type-->
                                            <img src="{$vo.imgurl}" style="width:auto;height:100px;"/>
                                        </td>
                                        {else/}
                                        <td style="text-align: center; vertical-align: middle; "><!--info_type-->
                                            <video style="width:auto;height:100px;" controls>
                                                <source src="{$vo.imgurl}"  type="video/mp4">
                                            </video>
                                        </td>
                                        {/if}


                                        <td style="text-align: center; vertical-align: middle; ">
                                            <a href="/admin/product/index_edit_img?id={$vo.id}" class="btn btn-success btn-edit btn-disabled" title="编辑"><i class="fa fa-pencil"></i> 修改</a>
                                            <a href="/admin/product/index_del_img?id={$vo.id}" class="btn btn-success btn-del" title="删除"><i class="fa fa-trash"></i> 删除</a>
                                        </td>
                                    </tr>
                                    {/volist}
                                    </tbody>
                                    <tr>
                                        <td colspan="9" style="padding-left:85px; ">
                                            <input type="submit" value="排序" class="group_btn" />
                                        </td>
                                    </tr>
                                </table>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>


<script language="javascript" type="text/javascript" src="/assets/My97DatePicker/jquery-1.8.2.js"></script>
<script>
function changeStatus(o){

    var id=$(o).attr("d_id");
    var pid=$(o).attr("d_pid");
  //  alert(id); alert(pid);
    $.ajax({
        type:'post',
        dataType:'json',
        url:"/admin/product/changeImg",
        data:{"id":id,"pid":pid},
        success:function(data){
            if(data==1){
                window.location.href="/admin/product/index_img?id="+pid;
            }else{
                alert("设置主图失败");
            }
        }
    })

}
</script>






